using System; 
using System.Threading; 
using System.Workflow.Activities; 
using System.Workflow.Runtime; 
 
namespace FooBar 
{
   class Hello 
   { 
      public static void Main()
      {
         using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) 
         {
            AutoResetEvent waitHandle = new AutoResetEvent(false);
 
            workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) 
            { 
               waitHandle.Set();
            }; 
 
            WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(FooBar.Demo)); 
            instance.Start(); 
            waitHandle.WaitOne(); 
         }
      }
   }
   partial class Demo
   {
	 	int X = 0;
	 	int Y = 0;
	 	int Z = 0;
	 	int M = 0;
		buscarTemperaturaClass buscarTemperatura= new buscarTemperaturaClass(); 
		tweetClass tweet= new tweetClass(); 
		initVarClass initVar= new initVarClass(); 
		storeClass store= new storeClass(); 
		loadClass load= new loadClass(); 

 
		private void iniciarVar0_ExecuteCode(object sender, EventArgs e) { 
			initVar.initVar("Media"); 
		}
		private void pegarTemp1_ExecuteCode(object sender, EventArgs e) { 
			X = buscarTemperatura.buscarTemperatura("Natal");
			Console.WriteLine(X); 
 		} 
		private void pegarTemp2_ExecuteCode(object sender, EventArgs e) { 
			Y = buscarTemperatura.buscarTemperatura("Recife");
			Console.WriteLine(Y); 
 		} 
		private void pegarTemp3_ExecuteCode(object sender, EventArgs e) { 
			Z = buscarTemperatura.buscarTemperatura("João Pessoa");
			Console.WriteLine(Z); 
 		} 
		private void guardarVar4_ExecuteCode(object sender, EventArgs e) { 
			store.store("Media", (X+Y+Z)/3); 
		}
		private void loadVar5_ExecuteCode(object sender, EventArgs e) { 
			M = load.load("Media");
			Console.WriteLine(M); 
 		} 
		private void tuitar6_ExecuteCode(object sender, EventArgs e) { 
			tweet.tweet("Temperatura na regiao nordeste " + M); 
		}
		private void finalizar_ExecuteCode(object sender, EventArgs e) { 
			Console.WriteLine("Tecle Enter para sair: "); 
  			Console.ReadLine();
		}
	}
}